package org.springblade.modules.repair.controller;

import com.alibaba.fastjson.JSONObject;
import org.springblade.core.tool.api.R;
import org.springblade.modules.repair.dto.BuildingSubmitDTO;
import org.springblade.modules.repair.entity.BusinessWork;
import org.springblade.modules.repair.service.BusinessWorkService;
import org.springblade.modules.repair.service.IBuildingService;
import org.springblade.modules.repair.vo.BuildingSubmitVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * @Date 15:09 2021/12/7
 * @Description {
 *    BusinessWorkController
 * }
 * @Author lsay
 **/
@RestController
@RequestMapping("/business/work")
public class BusinessWorkController {

	@Autowired
	private BusinessWorkService businessWorkService;
	@Autowired
	private IBuildingService buildingService;

	/**
	 * 获取项目勘误信息
	 * @param buildingId
	 * @return
	 */
	@GetMapping("/building/detail")
	public R<BuildingSubmitVO> buildingSubmitVOR(Long buildingId){
		return R.data(buildingService.buildingSubmitVOR(buildingId));
	}

	/**
	 * 添加项目勘误信息
	 * @param buildingSubmitDTO 项目勘误数据
	 * @return
	 */
	@PostMapping("/building/submit")
	public R<HashMap<String,Object>> saveBuildingSubmit(@RequestBody BuildingSubmitDTO buildingSubmitDTO){
		return R.data(businessWorkService.saveBuildingSubmit(buildingSubmitDTO));
	}

}
